﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>消息实体</title>
    <link href="../../../DataUser/Style/ccbpm.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="../../Scripts/bootstrap/js/jquery.min.js"></script>
    <script type="text/javascript" src="../../Scripts/config.js"></script>
    <script src="../../Scripts/QueryString.js" type="text/javascript"></script>
    <script type="text/javascript" src="../../Comm/Gener.js"></script>
    <base target="_self" />
    <script type="text/javascript">
        /*隐藏与显示.*/
        function ShowHidden(ctrlID) {

            var ctrl = document.getElementById(ctrlID);
            if (ctrl.style.display == "block") {
                ctrl.style.display = 'none';
            } else {
                ctrl.style.display = 'block';
            }
        }
    </script>
    <script type="text/javascript" language="javascript">
        //页面启动函数.
        $(function () {

            InitPage();

        });

        //初始化数据.
        function InitPage() {

            var fk_eventType = GetQueryString("FK_Event");
            var fk_MapData = GetQueryString("FK_MapData");

            // 设置标签
            $("#Title").html(fk_eventType);

            //组织事件的主键.
            var mypk = fk_MapData + "_" + fk_eventType;

            var eventEn = new Entity("BP.Sys.FrmEvent");
            eventEn.SetPKVal(mypk);
            eventEn.RetrieveFromDBSources();

            GenerFullAllCtrlsVal(eventEn); //给实体赋值.

        }

        //删除.
        function Delete() {

            if (confirm('您确定要删除吗？') == true)
                return;

            var fk_eventType = GetQueryString("FK_Event");
            var fk_MapData = GetQueryString("FK_MapData");
             

            //组织事件的主键.
            var mypk = fk_MapData + "_" + fk_eventType;

            var eventEn = new Entity("BP.Sys.FrmEvent");
            eventEn.SetPKVal(mypk);
            eventEn.RetrieveFromDBSources();
            eventEn.Delete();

            Back();
        }

        function Save() {

            var fk_eventType = GetQueryString("FK_Event");
            var fk_MapData = GetQueryString("FK_MapData");

            //组织事件的主键.
            var mypk = fk_MapData + "_" + fk_eventType;

            var eventEn = new Entity("BP.Sys.FrmEvent");
            eventEn.SetPKVal(mypk);

            var i = eventEn.RetrieveFromDBSources();

            eventEn.FK_Event = fk_eventType;
            eventEn.FK_MapData = fk_MapData;

            eventEn.EventDoType = $("#DDL_EventDoType").val();
            eventEn.DoDoc = $("#TB_DoDoc").val();

            if (i == 0)
                eventEn.Insert(); //保存.
            else
                eventEn.Update(); //保存.

            Back();
        }

        function Back() {
            var url = '';
            url = 'ActionForDtl.htm?FK_MapData=' + GetQueryString("FK_MapData") + '&FK_Node=' + GetQueryString('FK_Node') + '&FK_Flow=' + GetQueryString('FK_Flow') + '&m' + Math.random();
            window.location.href = url;
        }
    </script>
</head>
<body >
    <form id="cc">
       
                        <table style="width: 100%;">
                        <caption > <div id='Title' ></div> </caption>
                            <tr>
                                <td >事件类型
                                </td>
                                <td >
                                <select name="DDL_EventDoType" id="DDL_EventDoType" class="frmfields">

                                <option selected="selected" value="0">禁用</option>
	<option value="1">执行存储过程</option>
	<option value="2">执行SQL语句</option>
	<option value="3">执行URL</option>
	<option value="4">WebServices(未完成)</option>
	<option value="5">执行ddl文件的类与方法</option>
	<option value="6">EventBase类</option>
	<option value="7">业务单元</option>

                                    </select>
                                </td>
                            </tr>
                            <tr>
                                <td colspan="2">
                                   要执行的内容
                                </td>
                            </tr>

                            <tr>
                                <td colspan=2>
     <textarea name="TB_DoDoc" rows="12" cols="20" id="TB_DoDoc"  style="width: 100%;">
	 </textarea>

                                </td>
                            </tr>
                        </table>
                    <input type="button" name="Btn_Save" value="保存" id="Btn_Save" onclick="Save();"/>
                    <input type="button" name="Btn_Delete" value="删除" id="Btn_Delete" onclick="Delete();"/>
                    <input type="button" name="Btn_Back" value="返回" id="Btn_Back" onclick="Back();"/>

    </form>
</body>
</html>
